'use strict'

const Controller = require('egg').Controller

class DepartmentController extends Controller {
  async getDepartmentList() {
    const { ctx } = this
    const resBody = await ctx.service.managerrecord.department.getDepartmentList(
      ctx.query
    )
    ctx.body = resBody
  }
  async getSingleDepartment() {
    const { ctx } = this
    const resBody = await ctx.service.managerrecord.department.getSingleDepartment(
      { id: ctx.params.id }
    )
    ctx.body = resBody
  }
  async createDepartment() {
    const { ctx } = this
    const resBody = await ctx.service.managerrecord.department.createDepartment(
      ctx.request.body
    )
    ctx.body = resBody
  }
  async updateDepartment() {
    const { ctx } = this
    const resBody = await ctx.service.managerrecord.department.updateDepartment(
      ctx.request.body,
      ctx.params.id
    )
    ctx.body = resBody
  }
  async deleteDepartment() {
    const { ctx } = this
    const resBody = await ctx.service.managerrecord.department.deleteDepartment(
      ctx.params.id
    )
    ctx.body = resBody
  }
}

module.exports = DepartmentController
